home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / hplip.preinst < prev    next >
Encoding:
Text File  |  2012-01-15  |  1.9 KB  |  73 lines

  1. #! /bin/sh
  2. # preinst script for hplip
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. rm_udevrule() {
  9.     PKG="$1"
  10.     CONFFILE="$2"
  11.  
  12.     if [ -e "$CONFFILE" ]; then
  13.         md5sum="$(md5sum "$CONFFILE" | awk '{print $1}')"
  14.         old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKG | sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
  15.         if [ "$md5sum" = "$old_md5sum" ]; then
  16.             rm -f "$CONFFILE"
  17.         fi
  18.     fi
  19. }
  20.  
  21. # summary of how this script can be called:
  22. #        * <new-preinst> `install'
  23. #        * <new-preinst> `install' <old-version>
  24. #        * <new-preinst> `upgrade' <old-version>
  25. #        * <old-preinst> `abort-upgrade' <new-version>
  26. #
  27. # for details, see http://www.debian.org/doc/debian-policy/ or
  28. # the debian-policy package
  29.  
  30. case "$1" in
  31.     upgrade|install|abort-upgrade)
  32.     # Remove symlink, dpkg doesn't like it at all
  33.     if [ -h /usr/share/doc/hplip ]; then
  34.         rm -f /usr/share/doc/hplip
  35.     fi
  36.  
  37.     # Stop and remove any daemon from old HPLIP installations
  38.     if [ -x /etc/init.d/hplip ]; then
  39.         pkill hpiod || true
  40.         if pgrep hpiod >/dev/null; then sleep 3; pkill -9 hpiod || true; fi
  41.         if pgrep hpiod >/dev/null; then
  42.             echo 'Old HPLIP daemon (hpiod) should have been stopped, but did not.  Please kill manually before hplip can proceed'
  43.             exit 1
  44.         fi
  45.         rm -fR /etc/init.d/hplip
  46.             update-rc.d -f hplip remove
  47.     fi
  48.  
  49.     # Remove obsolete config file for HPLIP startup script
  50.     rm -f /etc/default/hplip
  51.  
  52.     # Remove obsolete udev rules
  53.     rm_udevrule hplip /etc/udev/rules.d/55-hpmud.rules
  54.     rm_udevrule hplip /etc/udev/rules.d/45-hplip.rules
  55.     rm_udevrule hplip /etc/udev/rules.d/024_hpmud.rules
  56.     rm_udevrule hplip /etc/udev/rules.d/56-hpmud_support.rules
  57.     rm_udevrule hplip /etc/udev/rules.d/z60_hplip.rules
  58.  
  59.     ;;
  60.  
  61.     *)
  62.         echo "preinst called with unknown argument \`$1'" >&2
  63.         exit 1
  64.     ;;
  65. esac
  66.  
  67. # dh_installdeb will replace this with shell code automatically
  68. # generated by other debhelper scripts.
  69.  
  70.  
  71.  
  72. exit 0
  73.